package com.day0915;


public class Text1 {
    public static void main(String[] args) {
        //字符串的操作
        String greeting = "Hello";
        //截取字符串     substring(值1，值2)  含值1不含值2  值2不写，默认截到字符串最后。
        System.out.println(greeting.substring(2));
//        拼接字符串
        System.out.println("lu".concat("zhouyue"));//luzhouyue
        System.out.println(String.join("-","2022","9","15"));//2022-9-15

        String str1 = "";
        String str2 = null;//字符串不存在
        System.out.println("=====");
//        if (str2.length() == 0 || str2 != null || !str2.equals("")){
//            System.out.println(true);
//        }
        if ("111".equals(str2)){
            System.out.println(true);
        }
        //if (str != null && str.lengthO != 0)

        String str = "helloee";
        for (int i = 0; i < str.length(); i ++){
            System.out.println(str.charAt(i));
        }
        System.out.println(str.indexOf("e"));//返回第一个e出现的位置
        System.out.println(str.lastIndexOf("e"));

        String str5 = "我是中国人，呃你呃呃好！";
        System.out.println(str5.replace("呃你呃呃","****"));
        String strs = "      wo shi zhong guo ren     ";
        System.out.println(strs.trim());//忽略前后空格

        String st = "床前明月光，疑似地上霜，举头望明月，低头思故乡。";
        String[] s = st.split("，");//分割字符串
        for (String ss : s) {
            System.out.println(ss);
        }

    }
}
